<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Document</title>
</head>
<body>

  <div id='app'>
    <common-head>
    </common-head>
  </div>


<template id="CommonHead">
  <div>
    <h1>公共头部（全局）</h1>
    <button>按钮</button>
  </div>
</template>
<script src='https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js'></script>
<script>
  const CommonHead = {
    template: '#CommonHead'
    ,data(){
      return {
        num: 10
      }
    }
  }
  // 注册全局组件
  Vue.component("CommonHead", CommonHead)
  const app = new Vue({
    el: '#app'
    ,data: {
      msg: 'Hello Vue'
    }
  })
</script>
</body>
</html>